package com.plian.system.service.im;

import com.plian.system.dto.im.BaseInvestmentExecutionNewDTO;
import com.plian.system.entity.im.BaseInvestmentExecutionNew;
import com.plian.system.entity.im.BaseInvestmentExecutionNew;
import com.plian.system.model.R;
import com.plian.system.mybatis.base.BaseService;
import com.plian.system.vo.im.BaseInvestmentExecutionNewVO;
import com.plian.system.vo.im.EffectiveInvestmentVO;
import com.plian.system.vo.im.ExecutionProjectSituationVO;
import com.plian.system.vo.report.ChartsVO;

import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.util.List;

/**
 * 服务类
 *
 * @author
 * @since 2019-09-27
 */
public interface IBaseInvestmentExecutionNewService extends BaseService<BaseInvestmentExecutionNew> {

    /**
     * 保存 包含子表
     * @param baseInvestmentExecution
     * @return
     */
    boolean submit(BaseInvestmentExecutionNew baseInvestmentExecution);

    /**
     * 获取detail obj对象
     * @param baseInvestmentExecutionVO
     * @return
     */
    R<BaseInvestmentExecutionNewVO> getDetailObj(BaseInvestmentExecutionNewVO baseInvestmentExecutionVO);


    /**
     * 每月只能填写一次
     * @param baseInvestmentExecution
     * @return
     */
    String checkMonth(BaseInvestmentExecutionNew baseInvestmentExecution);

    /**
     *  生成excel文件 并返回文件名  时间戳+"-"+uuid
     * @param baseInvestmentExecutionId
     * @return
     */
    String export(Long baseInvestmentExecutionId);

    /**
     * excel文件下载
     * @param key
     * @param response
     * @param os
     */
    void download(String key, HttpServletResponse response, OutputStream os);


    /**
     * 获取上月已填报数据
     * @param baseInvestmentExecution
     * @return
     */
    R<BaseInvestmentExecutionNewVO> getLastMonthObj(BaseInvestmentExecutionNew baseInvestmentExecution);

    /**
     * 年度项目投资计划完成率 柱状图
     * @param baseInvestmentExecutionDTO
     * @return
     */
    ChartsVO statisticsCompanyProportion(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

    /**
     * 企业完成投资情况
     * @param baseInvestmentExecutionDTO
     * @return
     */
    ChartsVO statisticsCompany(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

    /**
     * 各类重点项目投资计划完成情况
     * @param baseInvestmentExecutionDTO
     * @return
     */
    ChartsVO statisticsProjectNature(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

//    /** TODO DEL
//     * 各类重点项目投资计划完成情况
//     * @param baseInvestmentExecutionDTO
//     * @return
//     */
//    ChartsVO statisticsMainProject(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

//    /** TODO DEL
//     * 获取 完成率 gzw时特殊处理
//     * @param isGZW
//     * @param fillingMonth
//     * @param orgId
//     * @return
//     */
//    BigDecimal completeProportion(boolean isGZW, String fillingMonth, String orgId);

    /**
     * 项目执行情况按股权和固定资产分类
     * @param baseInvestmentExecutionDTO
     * @return
     */
    EffectiveInvestmentVO statisticsProjectByCompany(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

    /**
     *
     * @param baseInvestmentExecutionDTO
     * @return
     */
    List<ExecutionProjectSituationVO> statisticsProjectByProjectNature(BaseInvestmentExecutionNewDTO baseInvestmentExecutionDTO);

    String saveProjectExecution(String data);

    String export(String filingYear);

    void download(String key, HttpServletResponse response);
}
